;;;
;;;
;;;	Author:
;;;		Henry C. Francis
;;;		425 N. Ashe St.
;;;		Southern Pines, NC 28387
;;;
;;;	http://www.paracadd.com
;;;	All rights reserved.
;;;
;;;	Copyright:  
;;;	   Edited:  
(defun c:ldrfix ()
  (if c:mklayr nil (load"mklayr" "\nMKLAYER.LSP not found"))
  (c:svlayr)
  (setq oldosmode (getvar"osmode"))
  (setvar "osmode" 0)
  (setvar "cmdecho" 0)
  (if dimscl nil (load "dimscl" "\nFile DIMSCL.LSP not found! "))
  (dimscl)
  (princ "\nSelect SDSK leaders to convert: ")
  (SETQ polyset (SSGET '((-4 . "<OR")(0 . "LWPOLYLINE")(0 . "POLYLINE")(-4 . "OR>"))))
  (IF polyset
    (PROGN
      (SETQ plsln (SSLENGTH polyset))
      (SETQ cntr 0)
    ) ;_ end of progn
  ) ;_ end of if
  (WHILE
    (IF	(AND (< cntr plsln) polyset)
      (SETQ polyent (ENTGET (SSNAME polyset cntr)))
    )
    (cond ((eq(cdr(assoc 0 polyent))"LWPOLYLINE")
	     (setq pt10_1 (assoc 10 polyent)
		   pt40   (assoc 40 polyent)
		   pt41   (assoc 41 polyent)
		   pt10_2 (assoc 10 (member pt41 polyent))
		   pt10_3 (assoc 10 (cdr(member pt10_2 polyent)))
	     )
	     (if
	       (and
		 (equal(cdr pt41)(* 0.041667 dimsc)0.01)
		 (equal(distance(cdr pt10_1)(cdr pt10_2))(* 0.110 dimsc)0.1)
	       )
	       (progn
		 (setq polyent (subst (cons 41 0.0)(assoc 41 polyent)polyent))
		 (setq tmpent (append(reverse(cdr(member pt10_2(reverse polyent))))(cddddr(member pt10_2 polyent))))
		 (if (entmake tmpent)
		   (entdel (cdr(assoc -1 polyent)))
		   (entupd (cdr(assoc -1 new_polyent)))
		 )
		 (entmake tmpent)
		 (setvar"clayer"(cdr(assoc 8 polyent)))
		 (command ".insert" "ldraro" (cdr pt10_1) dimsc dimsc (* 180.0(/(angle(cdr pt10_1)(cdr pt10_2))pi)))
	       )
	       (princ "\nNo matching leaders found! ")
	     )
	     (c:rslayr)
	   )
	  ((eq(cdr(assoc 0 polyent))"POLYLINE")
	     (princ "\nNot an LWPOLYLINE! ")





;;;     (if (eq selent "VERTEX")
;;;       (progn
;;;	 (while
;;;	   (/= (cdr (assoc 0 (entget plnxt))) "SEQEND")
;;;	    (setq plv	(entget (entnext plnxt))
;;;		  plnxt	(cdr (assoc -1 plv))
;;;	    ) ;_ end of setq
;;;	 ) ;_ end of while
;;;	 (setq nplhe (entget (cdr (assoc -2 (entget plnxt))))
;;;	       plnxt (entnext (cdr (assoc -1 nplhe)))
;;;	 ) ;_ end of setq
;;;	 (while
;;;	   (/= (cdr (assoc 0 (entget plnxt))) "SEQEND")
;;;	    (setq newdpt (transpt plii (cdr (assoc 10 (entget plnxt)))))
;;;	    (setq plent (entget plnxt))
;;;	    (if (assoc 6 plent)
;;;	      (setq plent
;;;		   (subst
;;;		     (cons 6 cur_lt)
;;;		     (assoc 6 plent)
;;;		     plent
;;;		   ) ;_ end of subst
;;;	      ) ;_ end of setq
;;;	    )
;;;	    (setq plent
;;;		   (subst
;;;		     (cons 8 cur_la)
;;;		     (assoc 8 plent)
;;;		     plent
;;;		   ) ;_ end of subst
;;;	    ) ;_ end of setq
;;;	    (setq plent
;;;		   (subst
;;;		     (cons 10 newdpt)
;;;		     (assoc 10 plent)
;;;		     plent
;;;		   ) ;_ end of subst
;;;	    ) ;_ end of setq
;;;;	   (PRINC plent)
;;;;	    (PRINC
;;;	      (entmake plent)
;;;;	    )
;;;	    (setq plnxt (entnext (cdr (assoc -1 (entget plnxt)))))
;;;	 ) ;_ end of while
;;;;	 (PRINC (list (cons 0 "SEQEND")))
;;;;	 (PRINC
;;;	   (entmake (list (cons 0 "SEQEND")))
;;;;	 )
;;;       ) ;_ end of progn
;;;     ) ;_ end of if





	   )
    )
    (setq cntr (1+ cntr))
  )
  (princ)
)